#!/bin/sh
process="dispatch_server"
ps -ef |grep "${process}" | grep -v grep
pro_count=`ps -ef |grep "${process}" |grep -v grep | grep -v sh|wc -l`
for i in `seq $pro_count`
do
SEARCH_PID=`ps -ef |grep "${process}" | grep -v grep |grep -v sh| sed -n '1p'|awk '{print $2}'`

if [ $SEARCH_PID -ne 0 ]; then
echo "kill pid "$SEARCH_PID
kill -9 $SEARCH_PID
fi
done


PROGRAM_DIR=`dirname $0`
LOGFILE=$PROGRAM_DIR"/logs/loggertester"
#DATE=`date +%F | sed 's/-//g'``date +%T | sed 's/://g'`

if [ $LOGFILE ]; then
DATE=`date +%F | sed 's/-//g'``date +%H`
BACKLOGFILE=$LOGFILE"."$DATE".log"
#echo $BACKLOGFILE
mv $LOGFILE $BACKLOGFILE
fi

chmod +x admin/*
date -R > /var/www/html/srserver/restart.log
./admin/check_stat.sh 
